[IA64] Fix Xen crash when creating VTI domain
authorawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Tue, 23 Jan 2007 19:07:02 +0000 (12:07 -0700)
committerawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Tue, 23 Jan 2007 19:07:02 +0000 (12:07 -0700)
Xend will do a hypercall to destory domain when creating VTI guest fails.
If "is_vti" is not set at that point, HV will call relinquish_vcpu_resource(),
which is for non-VTI. It may try to free a NULL pointer, so dom0 crash.
This patch fix it.

Signed-off-by: Xu Anthony <Anthony.xu@intel.com>
Signed-off-by: Zhang Xin <xing.z.zhang@intel.com>
xen/arch/ia64/xen/vhpt.c

index c8846efc45614e94a592ddd578c88e7a767bd3af..67341328de273c45c2efed0155743626a8b055e2 100644 (file)
@@ -177,7 +177,9 @@ pervcpu_vhpt_alloc(struct vcpu *v)
 void
 pervcpu_vhpt_free(struct vcpu *v)
 {
-       free_domheap_pages(v->arch.vhpt_page, VHPT_SIZE_LOG2 - PAGE_SHIFT);
+       if (likely(v->arch.vhpt_page != NULL))
+               free_domheap_pages(v->arch.vhpt_page,
+                                  VHPT_SIZE_LOG2 - PAGE_SHIFT);
 }
 #endif